package com.tedu.hystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
//@EnableCircuitBreaker
//@EnableDiscoveryClient
//@SpringBootApplication
@SpringCloudApplication
public class HystrixApplication {
    @LoadBalanced
    @Bean
    public RestTemplate getRestTemplate(){
        SimpleClientHttpRequestFactory f=new SimpleClientHttpRequestFactory();
        f.setReadTimeout(1000);
        f.setConnectTimeout(1000);
        return new RestTemplate(f);
    }
    public static void main(String[] args) {
        SpringApplication.run(HystrixApplication.class, args);
    }

}
